package org.iplatform.felicajack;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

public class HUserAddActivity extends Activity {
    /** Called when the activity is first created. */
	static List<String> userNames = new ArrayList<String>();
	static GameHost gm = new GameHost();
    @Override
    public void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.huser_add_layout);
        final String userName = getIntent().getStringExtra("UserName");
        userNames.add(userName);
        String displayNames = "";
        for (final String name : userNames) {
        	if ("".equals(displayNames)) {
        		displayNames = name;
        	} else {
        		displayNames = displayNames + ", " + name;
        	}
        	User user = new User();
        	user._userName = displayNames;
        	gm.setUser(user);
        }
        ((TextView)findViewById(R.id.user_name)).setText(displayNames);

        findViewById(R.id.start_game).setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(final View v) {
				gm.start();
			}
		});
    }
}
